<template>
    <div class="phone-main">
        <div class="preview">
            <div class="head">
                <img class="nav-bar" src="https://static.scrm.keyid.cn/assets/images/web-pc/member-nav-bar.png" />
            </div>
            <div class="content">
                <el-scrollbar height="620px">
                    <div class="banner-list">
                        <img
                            v-if="!props.bannerList.length"
                            class="empty-banner"
                            src="@/assets/channelConfig/marketingApplet/icon-one.png"
                            alt="" />
                        <el-carousel height="232px">
                            <el-carousel-item v-for="(item, index) in props.bannerList" :key="index">
                                <img class="banner-img" :src="item.url" alt="" />
                            </el-carousel-item>
                        </el-carousel>
                    </div>
                    <div class="order-info">
                        <div
                            v-for="(item, index) in props.navigationData.component"
                            :key="index"
                            class="order-info-square">
                            <img
                                v-if="item.img"
                                class="order-info-img"
                                :src="item.img"
                                :class="[props.navigationData.num == 1 ? 'order-info-oneImg' : 'order-info-img']"
                                alt="" />
                            <img
                                v-if="!item.img && props.navigationData.num != 1"
                                class="order-info-img"
                                src="@/assets/channelConfig/marketingApplet/empty.png"
                                alt="" />
                            <div v-if="!item.img && props.navigationData.num == 1" class="order-content">
                                <img src="@/assets/channelConfig/marketingApplet/icon-one.png" alt="" />
                            </div>
                            <div v-if="item.name" class="order-info-title">{{ item.name }}</div>
                        </div>
                    </div>
                    <div class="poster-position">
                        <div v-if="!props.posterList.length" class="poster-content">
                            <img src="@/assets/channelConfig/marketingApplet/icon-one.png" alt="" />
                        </div>
                        <img
                            v-for="(item, index) in props.posterList"
                            :key="index"
                            :src="item.url"
                            alt=""
                            class="upload-img" />
                    </div>
                </el-scrollbar>
            </div>
            <div class="footer">
                <img class="tab-bar" src="https://static.scrm.keyid.cn/assets/images/web-pc/member-tab-bar.png" />
                <img class="bottom-img" src="https://static.scrm.keyid.cn/assets/images/web-pc/bottom-img.png" />
            </div>
        </div>
    </div>
</template>
<script setup lang="ts">
const props = defineProps({
    bannerList: {
        type: Array,
        default: () => {
            return [];
        }
    },
    posterList: {
        type: Array,
        default: () => {
            return [];
        }
    },
    navigationData: {
        type: Object,
        default: () => {
            return {};
        }
    }
});
</script>
<style lang="scss" scoped>
.phone-main {
    .preview {
        width: 414px;
        box-shadow: 0 0 14px 0 rgb(0 0 0 / 10%);

        // border: 1px solid red;
        margin: 0 auto;
        height: 720px;
        position: relative;
        background: #f9f9f9;
        overflow: hidden;
    }

    .head {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 272px;
        background: url('https://static.scrm.keyid.cn/assets/images/web-pc/member-nav-bg-img.png') no-repeat;
        background-size: 100% 272px;

        .nav-bar {
            width: 100%;
            height: 88px;
        }
    }

    .content {
        margin-top: 104px;
        background: #f9f9f9;

        .content-title {
            padding: 9px 0;
            color: #333;
            line-height: 25px;
            font-size: 16px;
            text-align: center;
        }

        .banner-list {
            margin: 16px;
            background: #fff;
            border-radius: 8px;
            overflow: hidden;
            position: relative;

            .empty-banner {
                position: absolute;
                top: 50%;
                left: 50%;
                transform: translate(-50%, -50%);
            }

            :deep(.el-carousel__button) {
                width: 6px;
                height: 6px;
                background: #fff;
                border-radius: 50%;
            }

            .banner-img {
                width: 100%;
                height: 100%;
            }
        }

        .order-info {
            background-color: #fff;
            padding: 16px 0;
            margin: 0 16px;
            display: flex;

            .order-content {
                margin: 16px;
                background: #fff;
                border-radius: 8px;
            }

            &-square {
                flex: 1;
                flex-shrink: 0;
                display: flex;
                justify-content: center;
                flex-direction: column;
                align-items: center;
            }

            &-title {
                margin-top: 12px;
                font-size: 14px;
                font-family: PingFangSC-Regular, 'PingFang SC';
                font-weight: 400;
                color: #312f2a;
            }

            &-img {
                width: 50px;
                height: 50px;
                border-radius: 20px;
            }

            &-oneImg {
                width: calc(100% - 32px);
                height: 80px !important;
                border-radius: 8px;
            }
        }

        .poster-position {
            margin: 16px 16px 180px;
            background: #fff;
            border-radius: 8px;
            overflow: hidden;

            .poster-content {
                height: 232px;
                display: flex;
                align-items: center;
                justify-content: center;
            }

            .upload-img {
                display: block;
                width: 100%;
            }
        }
    }

    .footer {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        background: #fff;

        .tab-bar {
            width: 100%;
            height: 79px;
        }

        .bottom-img {
            width: 100%;
            height: 34px;
        }
    }
}
</style>
